<script type="text/javascript" src="application/modules/Ialbum/externals/scripts/transform.js"></script>
<script type="text/javascript">
	en4.core.runonce.add(function(){
		<?php if( !$this->renderOne ): ?>
	    $('photo_viewmore').style.display = '<?php echo ((  $this->pho_paginator->count() <= $this->pho_paginator->getCurrentPageNumber()) ? 'none' : 'block' ) ?>';
		$('photo_loading').style.display = 'none';
	    $('photo_viewmore_link').removeEvents('click').addEvent('click', function(){
	    	$('photo_viewmore').style.display = 'none';
	    	$('photo_loading').style.display = '';		    
	        var request = new Request.HTML({
	            url : en4.core.baseUrl + 'widget/index/content_id/' + <?php echo sprintf('%d', $this->identity) ?>,
	            data : {
	              format : 'html',
	              subject : en4.core.subject.guid,
	              page_pho : <?php echo sprintf('%d', $this->pho_paginator->getCurrentPageNumber() + 1) ?>,
	    	      isAjaxPhoto: true        
	            },
	            evalScripts : true,
	            onSuccess : function(responseTree, responseElements, responseHTML, responseJavaScript) {
	              Elements.from(responseHTML).inject($('ialbum_thumbsphoto'));
	              en4.core.runonce.trigger();
	              Smoothbox.bind($('ialbum_thumbs'));	              
	            }
	          });
	         request.send();
	    });
	    <?php endif;?>    
	});
	function viewAllPhotos(){
		$('img_loading_photo').style.display = '';
		var request1 = new Request.HTML({
            url : en4.core.baseUrl + 'widget/index/content_id/' + <?php echo sprintf('%d', $this->identity) ?>,
            data : {
              format : 'html',
              subject : en4.core.subject.guid,
              page_pho : <?php echo sprintf('%d', $this->pho_paginator->getCurrentPageNumber() + 1) ?>,
    	      isAjaxPhoto: true,
    	      photos_itemCountPerPage: 999999999        
            },
            evalScripts : true,
            onSuccess : function(responseTree, responseElements, responseHTML, responseJavaScript) {
              $('ialbum_thumbsphoto').set('html', responseHTML);
              en4.core.runonce.trigger();
              Smoothbox.bind($('ialbum_thumbs'));
              $('img_loading_photo').style.display = 'none';	              
            }
          });
         request1.send();
	}
</script>
<?php if(!$this->isAjaxPhoto):?>
<div class="albumsHeader">
	<span class=" rfloat fsm fwn fcg">
		<?php echo $this->translate('View All');?>: 
		<a href="<?php echo $this->url(array('action'=>'show', 'user_id'=>$this->subject()->getIdentity(), 'type' => 'viewall', 'subject'=>'albums'), 'album_general', true);?>"><?php echo $this->translate('Albums')?></a>
	</span>
	<div>
		<h3 class="uiHeaderTitle">
			<?php if($this->subject()->getIdentity() == $this->viewer()->getIdentity()):
					echo $this->translate('Your Albums');
				  else:
					echo $this->translate('%s\'s Albums', $this->subject()->__toString());				
				  endif;
			?>			
		</h3>
	</div>
</div>
<?php if( $this->al_paginator->getTotalItemCount() > 0 ): ?>
	<?php echo $this->partial('horizontal_list_albums.tpl', 'ialbum',
	 array('paginator' =>  $this->al_paginator, 'ignore_by' => 'true'));?>
<?php else: ?>
    <div class="tip">
      <span>
        <?php echo $this->translate('%s has created an album yet.', $this->subject()->getTitle());?>
      </span>
    </div>
<?php endif; ?>

<!-- photos -->
<div class="clearfix"></div>
<div class="albumsHeader clearfix">
	<span class=" rfloat fsm fwn fcg">
		<img style="display: none;" src="application/modules/Ialbum/externals/images/fbloader.gif" id="img_loading_photo">
		<?php echo $this->translate('View All');?>: 
		<a onclick="viewAllPhotos();" href="javascript:void(0);<?php //echo $this->url(array('action'=>'show', 'user_id'=>$this->subject()->getIdentity(), 'type' => 'viewall', 'subject'=>'photos'), 'album_general', true);?>"><?php echo $this->translate('Photos')?></a>
	</span>
	<div>
		<h3 class="uiHeaderTitle">
			<?php if($this->subject()->getIdentity() == $this->viewer()->getIdentity()):
					echo $this->translate('Your Photos');
				  else:
					echo $this->translate('%s\'s Photos', $this->subject()->__toString());				
				  endif;
			?>			
		</h3>
	</div>
</div>
<?php endif;?>

<?php if( count($this->pho_paginator)> 0 ): ?>
	<?php //echo $this->partial('horizontal_list_photos.tpl', 'ialbum', array('paginator' =>  $this->pho_paginator))?>	
	<?php if(!$this->isAjaxPhoto):?>
		<ul class="thumbs thumbs_nocaptions ialbum" id="ialbum_thumbsphoto">
	<?php endif;?>
	    <?php echo $this->partial('horizontal_list_photos_iul.tpl', 'ialbum', array('paginator' =>  $this->pho_paginator))?>
	<?php if(!$this->isAjaxPhoto):?>    
		</ul>
	<?php endif;?>
	
<?php else: ?>
	<?php if(!$this->isAjax):?>
	    <div class="tip">
	      <span>
	        <?php echo $this->translate('%s has tagged in photos yet.', $this->subject()->getTitle());?>
	      </span>
	    </div>
	<?php endif;?>
<?php endif; ?>
<?php if(!$this->isAjaxPhoto):?>	
	<div style="" id="photo_viewmore" class="photo_viewmore" >
		<a class="buttonlink icon_viewmore" id="photo_viewmore_link" href="javascript:void(0);"><?php echo $this->translate("View More")?></a>
	</div>
	<div class="photo_viewmore" id="photo_loading" style="display: none;">
	  		<img src='<?php echo $this->layout()->staticBaseUrl ?>application/modules/Core/externals/images/loading.gif' style='float:left;margin-right: 5px;' />
	  		<?php echo $this->translate("Loading ...") ?>
	</div>
<?php endif;?>